@extends('admin.layout')
@section('title',$title)
@section('content')
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                友情链接列表
                <small></small>
            </h1>
           
        </section>
        @if(session('info'))
        <div class="alert alert-danger alert-dismissable">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                    <h4><i class="icon fa fa-ban"></i> 注意!</h4>
              <p>{{session('info')}}</p>         
        </div>
        @endif
        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    <div class="box">
                        <div class="box-header">
                            <h3 class="box-title"></h3>

                        </div><!-- /.box-header -->
                        <div class="box-body">
                        <form action="{{url('/admin/link/index')}}">
                        <div class="row">
                            <div class="col-md-2">
                                <div class="form-group">
                                    <select name="num" class="form-control">
                                        <option
                                        @if(!empty($request['num']) && $request['num'] == 10)
                                        selected
                                        @endif
                                        >
                                        10</option>
                                        <option
                                        @if(!empty($request['num']) && $request['num'] == 20)
                                        selected
                                        @endif
                                        >20</option>
                                        <option
                                        @if(!empty($request['num']) && $request['num'] == 30)
                                        selected
                                        @endif
                                        >30</option>
                                    </select>
                                </div>
                            </div>
                        
                        <div class="col-md-4 col-md-offset-6">
                            <div class="input-group input-group">
                                <input name="keywords" type="text" class="form-control" value="{{$request['keywords'] or ''}}">
                                <span class="input-group-btn">
                                <button class="btn btn-info btn-flat">搜索</button>
                                </span>
                            </div>
                        </div>
                        </form>
                        
                            <table id="example1" class="table table-bordered table-striped">
                                <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>头部图片</th>
                                    <th>链接名</th>
                                    <th>链接地址</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($data as $user)
                            	<tr>
                                    <td>{{$user -> id}}</td>
                            		<td><img src="{{ url('/uploads') }}/{{$user -> img_head}}" style="width:50px"></td>
                            		<td>{{$user -> name}}</td>
                            		<td><a href="{{$user -> url}}">{{$user -> url}}</a></td>
                            		<td><a href="/admin/link/edit/{{$user -> id}}">编辑</a> <a href="/admin/link/delete/{{$user -> id}}">删除</a></td>
                            	</tr>
                                @endforeach
                                </tbody>
                            </table>
                           {{$data -> appends($request) -> render()}}
                        </div><!-- /.box-body -->
                    </div><!-- /.box -->
                </div><!-- /.col -->
            </div><!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->
@endsection